//
//  CLpopularity.m
//  I-want-go
//
//  Created by dllo on 15/10/23.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "CLpopularity.h"
#import "CLpeopleViewCell.h"
#import "CLhottopic.h"
#import "CLtool.h"
#import "CLscreen.h"

@interface CLpopularity ()<UITableViewDataSource, UITableViewDelegate>
@property(nonatomic, retain)UITableView *peopleTableView;
@end

@implementation CLpopularity
- (void)dealloc {
    [_hotpicArr release];
    [_peopleTableView release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor cyanColor];
    
    self.peopleTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 375 * SWIDTH, 604 * SHEIGHT)];
    [self.view addSubview:self.peopleTableView];
    self.peopleTableView.rowHeight = 100 * SHEIGHT;
    
    self.peopleTableView.dataSource = self;
    self.peopleTableView.delegate = self;
    [_peopleTableView release];
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
//    NSLog(@"%ld", self.hotpicArr.count);
    return self.hotpicArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *reuse = @"reuse";
    CLpeopleViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuse];
    if (!cell) {
        cell = [[CLpeopleViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuse];
    }
    CLhottopic *ccc = [[CLhottopic alloc] init];
    ccc = self.hotpicArr[indexPath.row];
    cell.nameLabel.text = ccc.username;
    NSString *str = [NSString stringWithFormat:@"人气:%@", ccc.part_in_rate];
    cell.hotLabel.text = str;
    
    [cell.phoImage sd_setImageWithURL:[NSURL URLWithString:ccc.avatar]];
    cell.numberLabel.text = [NSString stringWithFormat:@"%ld", indexPath.row + 1];
//
    return cell;
}


- (void)viewWillAppear:(BOOL)animated {
    self.tabBarController.tabBar.hidden = YES;
}

- (void)viewWillDisappear:(BOOL)animated {
    self.tabBarController.tabBar.hidden = NO;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
